package com.zhanglijie.theory.future.futureandtask;

import java.util.concurrent.ExecutionException;

import com.zhanglijie.theory.future.Product;

/**
 * @author zhanglijie
 * @version 1.0
 * @since 1.1.0 2022/8/15 0015 0:04
 */
public class MyClient {
    public static void main(String[] args) throws InterruptedException, ExecutionException {
        Server server = new Server();
        Product a = server.request(4, 'A');
        Product b = server.request(5, 'b');
        Product c = server.request(4, 'C');
        Product d = server.request(2, 'D');

        System.out.println("本地可以做下面事情 等我本地做完了一起梭哈刚才调用的数据");
        //模拟业务空打印
        for (int i = 0; i < 10; i++) {
            Thread.sleep(300);
        }
        System.out.println("本地处理完毕");
        System.out.println(a.getContent());
        System.out.println(b.getContent());
        System.out.println(c.getContent());
        System.out.println(d.getContent());
    }
}
